﻿CREATE TABLE [dbo].[Templates] (
    [Id]           INT            IDENTITY (1, 1) NOT NULL,
    [Name]         NVARCHAR (MAX) NOT NULL,
    [CreationDate] DATETIME       NOT NULL,
    [CatchScore]   INT            NOT NULL,
    [ExactScore]   INT            NOT NULL,
    [Image]        NVARCHAR (MAX) NOT NULL,
    [StartDate]    DATETIME       NOT NULL,
    [EndDate]      DATETIME       NOT NULL,
    [Mode]         INT            NOT NULL,
    [GroupId]      INT            NOT NULL,
    CONSTRAINT [PK_Templates] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_GroupTemplate] FOREIGN KEY ([GroupId]) REFERENCES [dbo].[Groups] ([Id])
);


GO
CREATE NONCLUSTERED INDEX [IX_FK_GroupTemplate]
    ON [dbo].[Templates]([GroupId] ASC);

